package com.foundryx.shared.core.utils;

/**
 * @className: ObjectUtil
 * @author: ocxz1
 * @date: 2025/6/25 下午8:22
 * @Version: 1.0
 * @description: fx-share-resources
 */
public class ObjectUtil {

    /**
     * 判断对象是否是原始类型或者包装类
     * @param obj 对象
     * @return 是否是原始类型或者包装类
     */
    public static boolean isPrimitiveOrWrapper(Object obj) {
        if (obj == null) {
            return false;
        }

        Class<?> clazz = obj.getClass();

        return clazz.isPrimitive() || // 原始类型：int, long, double...
                clazz == Integer.class ||
                clazz == Long.class ||
                clazz == Double.class ||
                clazz == Float.class ||
                clazz == Short.class ||
                clazz == Byte.class ||
                clazz == Boolean.class ||
                clazz == Character.class ||
                clazz == String.class;
    }
}
